﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;

public partial class system_loademails2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string types = Request["mailtype"].ToString();

        int iNum = 1;
        string result = "<table width=90%>";
        result += "<tr>";
        string sSql = "select linkman,email from t_linkman where companyabb in (" + types + ") order by companyabb,linkman";
        TSqlDBReader myReader = new TSqlDBReader(sSql);
        while (myReader.FDataReader.Read())
        {
            string linkman = myReader.FDataReader.GetValue(0).ToString();
            string email = myReader.FDataReader.GetValue(1).ToString();

            if (iNum <= 3)
            {
                result += "<td>";
                result += "<input id=\"" + email + "\" name=\"email\" type=\"checkbox\" value=\"" + email + "\" checked />" + email + "(" + linkman + ")&nbsp;";
                result += "</td>";
            }
            else
            {
                result += "</tr>";
                result += "<tr>";
                result += "<td>";
                result += "<input id=\"" + email + "\" name=\"email\" type=\"checkbox\" value=\"" + email + "\" checked />" + email + "(" + linkman + ")&nbsp;";
                result += "</td>";

                iNum = 1;
            }

            iNum++;
        }
        myReader.Free();
        result += "</tr></table>";

        emaillist.Text = result;
    }
}
